class Solution {
public:
    int strStr(string haystack, string needle) {
   int i,j;
   bool m;
   int a=haystack.size();
   int b=needle.size();
        for(i=0;i<=a-b;i++){
            m=true;
            for(j=0;j<b;j++){
                if(haystack[i+j]!=needle[j]){
                    m=false;
                    break;
                }
            }
            if(j==b)    return i;
            else    continue;
        }
        return -1;
    }
};